export const setDatas = (initData, proxyData, primaryKey = 'id') => {
	if (Array.isArray(initData)) {
		proxyData.splice(
			0,
			Infinity,
			...initData
			.flat(Infinity)
			.filter((item) => item)
			.map((item, key) => {
				if (!Reflect.has(item, 'key')) {
					item.key = item[primaryKey] || key;
				}
				if (typeof primaryKey === 'function') {
					primaryKey(item, key);
				}
				return item;
			}),
		);
	}
};
